You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Gian Maria Ricci <al...@nablasoft.com> on 2012/07/19 17:10:32 UTC
searching on NOT_ANALYZED fields seems not working.
Hi to everyone,
I'm indexing a document with StandardAnalyzer and the document has this
format
document.Add(new Field("Id", id, Field.Store.YES, Field.Index.NOT_ANALYZED,
Field.TermVector.NO));
document.Add(new Field("content", test, Field.Store.COMPRESS,
Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
document.Add(new Field("channelname", "Forum", Field.Store.YES,
Field.Index.NOT_ANALYZED));
Now I'm expecting to being able to search with this code
Term t = new Term("channelname", "forum");
var query = new TermQuery(t);
var docs = indexSearcher.Search(query, 10);
but it always returns 0 documents. Documents are returned only if I use the
Field.Index.ANALYZED enum, but I should be able to search even in
NOT_ANALYZED especially because I do not want analyzer to mess up with
content of this field, and I want it to be stored and searched without
tokenizing.
Am I missing something? Thanks in advance.
Gian Maria
RE: searching on NOT_ANALYZED fields seems not working.
Posted by Gian Maria Ricci <al...@nablasoft.com>.
Thanks,
it is almost 12 hours in front of my PC :( and I'm starting to think that I
need to take a break ;),
I realized it was a casing problem few minutes after wrote this email, and I
realized that for today it is time to stop writing code :D :D
Thanks a lot for the quick response :)
Gian Maria.
-----Original Message-----
From: Granroth, Neal V. [mailto:neal.granroth@thermofisher.com]
Sent: giovedì 19 luglio 2012 17:15
To: lucene-net-dev@lucene.apache.org; alkampfer@nablasoft.com
Subject: RE: searching on NOT_ANALYZED fields seems not working.
The case of the first character of the stored term "Forum" and the search
term "forum" differ.
- Neal G.
-----Original Message-----
From: hotmail_288fbf38c031d5f3@live.com
[mailto:hotmail_288fbf38c031d5f3@live.com] On Behalf Of Gian Maria Ricci
Sent: Thursday, July 19, 2012 10:11 AM
To: lucene-net-dev@lucene.apache.org
Subject: searching on NOT_ANALYZED fields seems not working.
Hi to everyone,
I'm indexing a document with StandardAnalyzer and the document has this
format
document.Add(new Field("Id", id, Field.Store.YES, Field.Index.NOT_ANALYZED,
Field.TermVector.NO));
document.Add(new Field("content", test, Field.Store.COMPRESS,
Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
document.Add(new Field("channelname", "Forum", Field.Store.YES,
Field.Index.NOT_ANALYZED));
Now I'm expecting to being able to search with this code
Term t = new Term("channelname", "forum");
var query = new TermQuery(t);
var docs = indexSearcher.Search(query, 10);
but it always returns 0 documents. Documents are returned only if I use the
Field.Index.ANALYZED enum, but I should be able to search even in
NOT_ANALYZED especially because I do not want analyzer to mess up with
content of this field, and I want it to be stored and searched without
tokenizing.
Am I missing something? Thanks in advance.
Gian Maria
RE: searching on NOT_ANALYZED fields seems not working.
Posted by "Granroth, Neal V." <ne...@thermofisher.com>.
The case of the first character of the stored term "Forum" and the search term "forum" differ.
- Neal G.
-----Original Message-----
From: hotmail_288fbf38c031d5f3@live.com [mailto:hotmail_288fbf38c031d5f3@live.com] On Behalf Of Gian Maria Ricci
Sent: Thursday, July 19, 2012 10:11 AM
To: lucene-net-dev@lucene.apache.org
Subject: searching on NOT_ANALYZED fields seems not working.
Hi to everyone,
I'm indexing a document with StandardAnalyzer and the document has this
format
document.Add(new Field("Id", id, Field.Store.YES, Field.Index.NOT_ANALYZED,
Field.TermVector.NO));
document.Add(new Field("content", test, Field.Store.COMPRESS,
Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
document.Add(new Field("channelname", "Forum", Field.Store.YES,
Field.Index.NOT_ANALYZED));
Now I'm expecting to being able to search with this code
Term t = new Term("channelname", "forum");
var query = new TermQuery(t);
var docs = indexSearcher.Search(query, 10);
but it always returns 0 documents. Documents are returned only if I use the
Field.Index.ANALYZED enum, but I should be able to search even in
NOT_ANALYZED especially because I do not want analyzer to mess up with
content of this field, and I want it to be stored and searched without
tokenizing.
Am I missing something? Thanks in advance.
Gian Maria