If you store the field unanalyzed it will be indexed as is. You can then search for it via a TermQuery, or use QueryParser with PerFieldAnalyzerWrapper specifying KeywordAnalyzer for the field containing this character.
Another approach is to replace the % with something easier to work with. You could do this yourself or, I think, with MappingCharFilter. Personally I'd probably replace "%" with "percent" somewhere in my code with a simple string replacement. -- Ian. On Tue, Dec 8, 2009 at 5:02 PM, kanayo <richies4...@gmail.com> wrote: > > Thanks for your reply Erick. > > In Luke, its also not working. I tried to retrieving values from the field > by specifying the field as the search field and then specify % as the search > parameter which using StandardAnalyzer but nothing is displayed. Also while > Luke shows the query details for other search values, it dosent show query > details for search value of %. > > I think it is not Tokenized in the index. Is there anything else i can do to > be able to retrieve values from fields comprising of just %? > > Thanks for your assistance. > > > Erick Erickson wrote: >> >> Try printing out query.toString() to see what's actually being >> sent to the searcher. >> >> You can try the same thing in Luke, specifying StandardAnalyzer >> to parse queries. >> >> Are you sure you're specifying the fields in the query and not just the >> '%'? That would go against your default field. >> >> When you say that you can see the fields in luke, are you storing the >> field? >> Because what you may be seeing is the *stored* value rather than the >> *tokens*. >> Make sure you're looking at the tokens in Luke.. >> >> If none of that helps, could you post a code snippet or two (index and >> query)? >> >> Best >> Erick >> >> On Tue, Dec 8, 2009 at 11:04 AM, kanayo <richies4...@gmail.com> wrote: >> >>> >>> Hi, >>> >>> I am a newbie to lucene. I am using Standard Analyzer in my lucene >>> project. >>> I am indexing some fields which may contain only "%" as a field value and >>> it >>> indexes fine and i can view the value against the field in the index >>> using >>> Luke. >>> >>> However when i try to retrieve the same field using indexsearcher and >>> passing "%" as a query parameter nothing is retrieved. It is simply being >>> ignored. I have also tried to escape the "%" while searching but still no >>> results. >>> >>> Is there anything am not doing right? >>> >>> Thanks in advance for your assistance. >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Problem-searching-field-with---as-value-tp26696184p26696184.html >>> Sent from the Lucene - Java Users mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >>> For additional commands, e-mail: java-user-h...@lucene.apache.org >>> >>> >> >> > > -- > View this message in context: > http://old.nabble.com/Problem-searching-field-with---as-value-tp26696184p26696993.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org