Results 1 to 6 of 6
  1. #1
    Zonder is offline Member
    Join Date
    Aug 2011
    Posts
    4
    Rep Power
    0

    Default 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.

  2. #2
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    Can you show some pseudo-code? Because it is difficult to understand where you have mistakes.
    Skype: petrarsentev
    http://TrackStudio.com

  3. #3
    Zonder is offline Member
    Join Date
    Aug 2011
    Posts
    4
    Rep Power
    0

    Default

    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.

  4. #4
    Petr's Avatar
    Petr is offline Senior Member
    Join Date
    Jan 2011
    Location
    Russia
    Posts
    620
    Rep Power
    4

    Default

    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

  5. #5
    Zonder is offline Member
    Join Date
    Aug 2011
    Posts
    4
    Rep Power
    0

    Default

    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.

  6. #6
    Zonder is offline Member
    Join Date
    Aug 2011
    Posts
    4
    Rep Power
    0

Similar Threads

  1. problem in searching
    By mridulbirla in forum AWT / Swing
    Replies: 9
    Last Post: 04-05-2011, 11:22 AM
  2. Searching Problem
    By kostas885 in forum Lucene
    Replies: 0
    Last Post: 12-08-2010, 10:19 PM
  3. Replies: 4
    Last Post: 07-27-2010, 08:52 PM
  4. Searching In a String Array - Problem
    By DillMan in forum New To Java
    Replies: 4
    Last Post: 12-07-2008, 09:12 PM
  5. Problem with searching while using GUI
    By BHCluster in forum AWT / Swing
    Replies: 1
    Last Post: 04-24-2008, 06:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •