Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Lucene

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


seethalrd at gmail

Oct 12, 2009, 3:55 AM

Post #1 of 2 (338 views)
Permalink
Lucene

Hi ,
I am using StandardAnalyzer for indexing as well as searching the
indexes.But my search doesn't work correctly with special characters.I am
storing some special characters in a field called TransType.ie
document.add(new Field("TransType", "db92fb60-b716-11de-8718-001a4bc7d46e",
Field.Store.YES, Field.Index.NOT_ANALYZED));

I am using the StandardAnalyser for searching also.
ie
IndexSearcher[] indxSearcher = new IndexSearcher[indexNameList.size()];
for (String indexName : indexNameList) {
......................
}

String[] fields ={ "Path", "TransType"};
MultiFieldQueryParser queryParser = new MultiFieldQueryParser(fields,new
StandardAnalyzer());
Query query = queryParser.parse(qryString);
ParallelMultiSearcher parallelMultiSearcher = new
ParallelMultiSearcher(indxSearcher);
Hits hits = parallelMultiSearcher.search(query,new Sort(new
SortField("CreatedTicks",SortField.STRING, true)));
System.out.println(hits.length());

But in my TransType search,if I give any of the special
characters it is displaying the entire list.ie if I search TransType : $ it
is showing the entire list.But I want Transtype search to work only if I
give the value which I have
stored(db92fb60-b716-11de-8718-001a4bc7d46e)....Please help me out to
resolve this issue
--
View this message in context: http://www.nabble.com/Lucene-tp25853791p25853791.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


ian.lea at gmail

Oct 12, 2009, 4:07 AM

Post #2 of 2 (307 views)
Permalink
Re: Lucene [In reply to]

You are storing this field without analysis, correctly as you want
exact matches only, but using StandardAnalyzer at query time. Use
PerFieldAnalyzerWrapper, specifying KeywordAnalyzer for this field.
Using MultiFieldQueryParser may not make much sense here.


--
Ian.



On Mon, Oct 12, 2009 at 11:55 AM, nja <seethalrd [at] gmail> wrote:
>
> Hi ,
>         I am using StandardAnalyzer for indexing as well as searching the
> indexes.But my search doesn't work correctly with special characters.I am
> storing some special characters in a field called TransType.ie
> document.add(new Field("TransType", "db92fb60-b716-11de-8718-001a4bc7d46e",
> Field.Store.YES, Field.Index.NOT_ANALYZED));
>
> I am using the StandardAnalyser for searching also.
> ie
> IndexSearcher[] indxSearcher = new IndexSearcher[indexNameList.size()];
> for (String indexName : indexNameList) {
>                                        ......................
> }
>
> String[] fields ={ "Path", "TransType"};
> MultiFieldQueryParser queryParser = new MultiFieldQueryParser(fields,new
> StandardAnalyzer());
> Query query = queryParser.parse(qryString);
> ParallelMultiSearcher  parallelMultiSearcher = new
> ParallelMultiSearcher(indxSearcher);
> Hits hits = parallelMultiSearcher.search(query,new Sort(new
> SortField("CreatedTicks",SortField.STRING, true)));
> System.out.println(hits.length());
>
>           But in my TransType search,if I give any of the special
> characters it is displaying the entire list.ie if I search TransType : $ it
> is showing the entire list.But I want Transtype search to work only if I
> give the value which I have
> stored(db92fb60-b716-11de-8718-001a4bc7d46e)....Please help me out to
> resolve this issue
> --
> View this message in context: http://www.nabble.com/Lucene-tp25853791p25853791.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.