AnsweredAssumed Answered

How can I do a case insensitive search without tokenize

Question asked by spilby on Jun 20, 2015
Hello everyone!

I'm using this expression to search a string custom property of my tree:


String query = "PATH: \"/" + myPath + "/cm:" + folder + "//.\"" + " AND TYPE:\"" + myType + "\"" + " AND =@mod\\:" + myCustomProperty + ":\"" + searchValue + "\"";   SearchParameters sp = new SearchParameters(); sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); sp.setQuery(query); ResultSet results = getSearchService().query(sp);


And I have this on my model.xml


<namespace uri="myCustomNS" prefix="mod" />   <property name="mod:myCustomProperty" editVisible="true" createVisible="true" editable="true" inheritable="false" calculable="true"> <title>My custom property</title> <type>d:text</type> <mandatory>true</mandatory> <index enabled="true"> <atomic>true</atomic> <stored>false</stored> <tokenised>both</tokenised> </index> <constraints> <constraint ref="desal:stringLength100" /> </constraints> </property>   


I use LANGUAGE_FTS_ALFRESCO instead of LANGUAGE_LUCENE because of the "=" operator in the search.

I need to find the exact phrase that I have on the value property, with case insensitive search.  I want the results, with lower or upper case. And I can't change my xml model.

If I change the query without the = and I put @mod\\: instead of =@mod\\: the search is case insensitive, like I want. But don't find with exact phrase. For example: I have a "ABC 1" value, when I search "ABC" returns ok and find it, and I don't want this. The query tokenize the result.

I try to do the query with the QueryParser of Lucene 2.4.1. I do this:

QueryParser.escape(value)

where value is the property value with the white spaces. But not works.

I try to replace manually whitespaces on the query.

value.replaceAll(" ", "\\_x0020_");

or

value.replaceAll(" ", "\\u00A0");

but also not works, and returns me ok if I find "ABC" and I have "ABC 1".

I don't know what can I do more.

Where is the problem? How can I do this search with FTS, case insensitive and with exact phase? Maybe my query is wrong? Maybe a problem with the "?

Thank you very much!

Outcomes