dcsimg
Special charcter can not be used as first character
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Santanu_Dutta
Posted On:   Thursday, October 28, 2004 10:29 PM

In lucene if I search any term with '*' or '?' it will not return any result as it is defined by lucene that these two character cannot be used as first character.



If search a term with '~' as a first character then also it is not returning any result. But if I use '%' then it is giving all the results those were coming without the special character.



Is there any rule, so that we can specify that these characters cannot be used as a first character?
Or itÂ’s depends on the analyzer?



Can anybody focus on this?

Re: Special charcter can not be used as first character

Posted By:   Anonymous  
Posted On:   Friday, October 29, 2004 07:30 AM

Hi,


My two bits on this..


This essentially depends on the rules defined for the QueryParser. You can use your own analyzer and define the rules separately. However if the application is searching for textual information, having these starting characters will not have much significance.


A different situtation is where you want to search for something like C++ or c# and the parser will strip off the + or # characters and end up searching for 'c'. In these situations the way to go will definitely change the grammer, the simplest of which would be to create these as additional special tokens. (This was suggested to me by Doug Cutting in reply to a question).


HTH.

About | Sitemap | Contact