Results 1 to 6 of 6
Thread: Searching Problem
- 08-25-2011, 11:11 AM #1
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Searching Problem
I am probably misunderstanding somthing but I am a bit stuck on how to do this
What I have got is a field marked as I-S-----0--- inside luke I am trying to search this field using the queryparser as normal so my search is Field:mysearch but this never finds any results also if I right click in luke a term in the top ranking section for this field it also finds no results. But if I go to documents and browse by term and click show all docs it finds all the results.
I am using luke to test the index but I am also getting the same through code should I be doing somthing else with a non tokenized field? This field can't be tokenized it needs an exact match on it.
- 08-25-2011, 01:42 PM #2
Can you show some pseudo-code? Because it is difficult to understand where you have mistakes.
Skype: petrarsentev
http://TrackStudio.com
- 08-25-2011, 03:08 PM #3
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
This query returns 0 results
(Forename:(Zonder) OR Surname:(Zonder) OR NickName:(Zonder)) AND ObjectType:(Profile)
This query returns results
(Forename:(Zonder) OR Surname:(Zonder) OR NickName:(Zonder))
ObjectType is stored in the index but not tokenized.
If I perform a term lookup in luke on ObjectType = Profile it finds all the documents as it should.
If I perform a query search in luke with the first statment above it finds 0 results but the documents should match.
As I said I am probably missing somthing here as luke can locate the items through the document tab but it does have the issue I am getting on the query tab.
Forgot to mention I am actually using the .NET port for coding but in this both java and .net are giving same results
Here is my search code
objSearcher = new IndexSearcher(Directory, false);
QueryParser objParser = new QueryParser("", Analyzer);
Query objQuery = objParser.Parse(Criteria);
var objHits = objSearcher.Search(objQuery);Last edited by Zonder; 08-25-2011 at 03:12 PM.
- 08-26-2011, 12:50 PM #4
No. I mean show code where you create index and fulling data. By the way "new QueryParser("", Analyzer)" it means that you try to find empty fields. Of course Lucene will get result 0.
Skype: petrarsentev
http://TrackStudio.com
- 08-26-2011, 01:18 PM #5
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Sorry I misunderstood :)
Yes I know passing "" on parser isn't quite right as if I don't explicitly set the field then it has no default so it won't know what to search. With the queries I am using though I am always explicitly setting the field to search
Here is my indexing code
Writer Creation
var objIndexWriter = new IndexWriter(Directory, Analyzer);
objIndexWriter.SetMaxMergeDocs(250000);
objIndexWriter.SetUseCompoundFile(true);
objIndexWriter.SetRAMBufferSizeMB(256);
Document Creation happens multiple times it is read from a queue
var objDocument = new Document();
var objField = new NumericField("PartitionKey", 1, Field.Store.YES, false);
objField.SetLongValue(Convert.ToInt64(Task.Partiti onKey));
objDocument.Add(objField);
objField = new NumericField("RowKey", 1, Field.Store.YES, false);
objField.SetLongValue(Convert.ToInt64(Task.RowKey) );
objDocument.Add(objField);
objDocument.Add(new Field("ObjectType", Task.ObjectType, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
foreach (var objValue in Task.Values)
{
objDocument.Add(new Field(objValue.Key, objValue.Value, Field.Store.YES, Field.Index.ANALYZED));
}
Closing of the Index
IndexWriter.Commit();
IndexWriter.Close(true);Last edited by Zonder; 08-26-2011 at 01:20 PM.
- 08-31-2011, 12:33 PM #6
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
problem in searching
By mridulbirla in forum AWT / SwingReplies: 9Last Post: 04-05-2011, 11:22 AM -
Searching Problem
By kostas885 in forum LuceneReplies: 0Last Post: 12-08-2010, 10:19 PM -
problem searching for a String element in a paralell array
By david185000 in forum New To JavaReplies: 4Last Post: 07-27-2010, 08:52 PM -
Searching In a String Array - Problem
By DillMan in forum New To JavaReplies: 4Last Post: 12-07-2008, 09:12 PM -
Problem with searching while using GUI
By BHCluster in forum AWT / SwingReplies: 1Last Post: 04-24-2008, 06:56 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks