Forums / Extensions / eZ Find / Wildcards and phrases and 'spanish order' of the results

Wildcards and phrases and 'spanish order' of the results

Author Message

Carlos Revillo

Tuesday 07 July 2009 6:20:54 am

Hi. I have two questions. Maybe they're not related to eZFind but Solr itself, but maybe some of you has similar issues.

First One. I would like to know if it's possible find a way to search for Articles that starts with a letter. I'll try to explain.

Supponse you have two articles. One is entitled 'Once upon a time' and the other one is 'in and old country'.

Doing a search like

{def $search = fetch('ezfind', 'search', hash( 
							'query', '',
							'class_id', array( 78 ),
							'filter', 'article/title:o*'
))}

i get these two articles in the results but i only 'need to find' the first one. trying to enquote the search doesn't work. so, i need a way, if possible, to work with wildcards and entire phrases.

The second one is related to spanish tildes. Suppose you have a set of words like:

avión
ángel
casa

if i filter by 'a*' i get

avión
ángel

and that's ok. but i only need to orther those words i get

avión
casa
ángel

So, is there any way to tell solr that 'á' should be between 'a' and 'b' for the orders?

Thank you.

Max Keil

Tuesday 07 July 2009 4:07:56 pm

Hi Carlos,

first issue:
I tried to execute the search on our eZ Find index. I can confirm that "o*" in your filter returns the objects with the second word starting with "o", but only if this attribute were indexed as "text" in your ezfind.ini. It's the normal case for text-lines.
- You can bypass this by changing text-lines into "string" types, but another problem appears: after this you cannot search for parts of the string.
- You can also create your own ezfSolrDocumentFieldBase class which would handles the indexing of text-lines - here you would store the name in two different ways:
-- first: as a string
-- second as a text
so both versions would be indexed in solr and you have to decide which of the types you take.

second issue:
solr is sorting in "natural order", so the extended ascii chars are located at the end. I found an interessting article about a similar problem:
http://wiki.epc.ub.uu.se/display/~ronnie/International+Sorting

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Carlos Revillo

Wednesday 08 July 2009 1:37:09 am

Hi Max.

Your reply has helped me a lot. I only need this condition (look in the entire field) for a few specific attributes. At first, those attributes was defined as ezstring.

So, what i've done is to build a custom datatype (just a copy of de default ezstring with some changes in the names) and map this datatype to string in my ezfind.ini.append.php.
Something like

[SolrFieldMapSettings]
DatatypeMap[ezcustomtext]=string

Then, I just added new attributes of this type to the classes, and with a cli script, i copied the values from the old attributes to the new ones and finally deleted the old ones. After running indexing script all is working as i want for those fields, so thank you very much!

For the second issue i will look at your recomendations. Thanks again.

Max Keil

Wednesday 08 July 2009 3:23:06 pm

Hi,

nice to read it. You're welcome!

Mit freundlichen Grüßen
Best regards

Max Keil

____________________________________________________________
eZ Publish Gold Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh