cancel
Showing results for 
Search instead for 
Did you mean: 

Problem lucene filter with dot and dash

joseacc
Champ in-the-making
Champ in-the-making
Hi.

In a Lucene query, filtering using a dash not return records.

For example:

My definition of metadata filtering is…
<property name="reg:code">
<title>Code Reg</title>
<type>d:text</type>
<mandatory>false</mandatory>
</property>

With values…
Z-2010-00001
Z-2010-00002
Z-2010-00003

My implementation of the search is…
SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE);

String query = new String("PATH:\"/app:company_home/st:sites/cm:mysite//*\" AND @reg\\:code:\"Z-2010-*\"");
ResultSet resultsLucene = webScriptHelper.getServices().getSearchService().query(sp);

However if I use the filter @reg\\:code:\"Z-2010-0*\" if return records.

It seems that this filter "-*" does not work. Also fails using filters with dot (for example, "exam*.txt").

I configured the Spanish language in Alfresco and use Alfresco Community v3.2r (build 2384, schema=3003) - Preconfigured Tomcat bundle.

Any ideas?

Thanks
2 REPLIES 2

openpj
Elite Collaborator
Elite Collaborator
Probably you have to define your custom property without tokenize the value:

<property name="reg:code">
<title>Code Reg</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
  <atomic>false</atomic>
  <stored>false</stored>
  <tokenised>false</tokenised>
</index>
</property>
In this way you should find results using that Lucene query.

Hope this helps.

joseacc
Champ in-the-making
Champ in-the-making
Hi Piergiorgio,

It works,


<property name="reg:code">
<title>Code Reg</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
  <atomic>true</atomic>
  <stored>false</stored>
  <tokenised>false</tokenised>
</index>
</property>

thanks