Priority Help Needed ASAP for Nested parent and phrase search

42 views
Skip to first unread message

srinivas

unread,
Sep 25, 2019, 11:10:24 PM9/25/19
to Whoosh
 Hi , I am actually using a nested parent query to do the search 

 lets say example:

with ix.searcher as searcher:
      'name field is a parent class in hire-achy and details is a child' 
      name_parser = qparser.QueryParser('name',ix.schema,group = qparser.OrGroup)
      details_parser = qparser.QueryPaser('details',ix.schema)
      my_query = "srinivas raju","sai akhil","manish reddy"
      name = name_parser.parse(u' '+ my_query)
      'if i print name it will be like "srinivas raju" or "sai akhil" which is fine'
      details = details_parser.parse(u ' ' + 'mumbai')
      'i actually have  more fields like a person name, email , phone number etc  ,i used nested parent because even if i search for details,phone number it should return the name i have an id for the name field where i can catch with hit['id']
      parent = query.Term("hireachy","parent")
      "i want to search both fields at a time if possible thats why i used or group"
      children_set = query.And([name,details])
      nested_parent_param = query.Nestedparent(parent,children_set)
     results = searcher.search (nested_parent_param)
     
     "This is where i am facing problems , if i say hit.highlights i am getting individual terms and if i say terms=True while search it returns empty values when highlighting because m using a phrase,think so"

     for hit in results:
          "it returns parent as expected but hit.highlights is a problem"
           print(hit["id"])

questions

1) is it possible to highlight the whole matched phrase and score accordingly?

2) why i am i getting empty results when highlighting when terms = True is set , or else i am getting the highlights but  individual terms

3) will nested parent query will make the search slow ?

4) is there any other way to optimize the code to make it faster ? 


Any help is appreciated ASAP 

Thank you.






      





Reply all
Reply to author
Forward
0 new messages