Pradeep,
Additional-query terms are not included in snippet highlighting, because terms
in additional-query are not supplied by the end user. It's easy to imagine use
cases in which the additional-query represents "bookkeeping" terms that the end
user doesn't care about (but the developer does); at the time of the decision,
it seemed like the use cases where such terms *should* be highlighted are less
common.
Without understanding more about your constraints, it's hard to know exactly
what to recommend, but I don't recommend modifying the library directly. That
is likely to cause you pain on upgrade. There are several possibilities I can
think of for you to experiment with, though.
First, search:search() accepts a sequence of query terms in the first argument;
these are "anded" together in parsing, the same way that additional-query terms
are "anded" with the parsed query for execution. So you could do
search:search(("parsed","additional","another"),$options), where "parsed"
represents user-supplied terms, and the others represent terms you are
currently handling with additional-query. All words would be included in the
parsed query and in highlighting.
Alternatively, you could parse first using search:parse(), modify the parse
tree to add the query terms, then call search:resolve(), passing in your
manipulated query. That has some risks in terms of how the parsed query
interacts with other features like snippeting and unparsing, but it is worth
exploring and testing.
There may be other ways as well, but hopefully this is enough to get you
started.
--Colleen
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Pradeep Maddireddy
Sent: Monday, May 31, 2010 6:59 AM
To: General
Subject: [MarkLogic Dev General] Search API Snippet Additional Query
Hi..!
Because of some constraints I had to use Additional Query part
instead of search term while using the search API. After I started
using the Additional Query part, the snippet part isn't working
correctly, it is just returning some text instead of hit-higlighting
the search term.
I check the API code, only parsed query instead of combined query
(parsed qry + additional qry)
is being passed to the do-snippet function, once I changed it to
combined query I got the desired output but I am just skeptical if
this would break any thing else.
snip:do-snippet($result, $parsed-query,$options/opt:transform-results)
Can someone help me.
Thanks
Pradeep Maddireddy
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general