cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene query on fields: how to search the beginning only

nvir
Champ in-the-making
Champ in-the-making
Hello,

I have a document which has an attribute which could contains "A B C",
another one could contains "B C A".

Which syntax do I have to use to search with Lucene to get the first one, values starting with "A".

I tried to use @attribute:A[^] (found on http://wiki.alfresco.com/wiki/Review_Of_Full_Text_Search_Query_Syntax (further extensions: so when could we use this ?)).

Greetings
2 REPLIES 2

andy
Champ on-the-rise
Champ on-the-rise
Hi

It is  not so easy.

The best approach is to use dual tokenisation which will ba available in 3.2, or not to tokenise the property.
Then use Alfresco FTS to do a pattern search "A*"

Andy

nvir
Champ in-the-making
Champ in-the-making
Thanks for your reply. By the way we have changed the analyzer for some of our properties, they are not tokenized or transformed for instance (from "A B C" to "A_B_C", or anything else which is not a stop word), and now we could search and find what we needed to.

Greetings,
Alain