What does the query plan show you? xdmp:plan(cts:search(doc(), ..."unfiltered"))
Could be lexicon expansion is too large or is being defeated in some way. The one character index will give you accurate results, but you will pay for it in disk space. //Mary On Mon, 31 Mar 2014 00:53:32 -0700, Amit Kumar Dev <[email protected]> wrote: > Thanks! Mary > > As suggested I have enabled three character search and word lexicon with > codepoint collation. > Also additionally enabled trailing wildcard search index. > But still search is not returning accurate response for single character > and two character wild card search. > > MarkLogic version is 6.0-2.3 > > Below is the sample query: > xquery version "1.0-ml"; > > let $searchQuery := cts:query( > <cts:element-word-query> > <cts:element>title</cts:element> > <cts:text>A*</cts:text> > <cts:option>wildcarded</cts:option> > </cts:element-word-query>) > return cts:search(fn:doc(), $searchQuery, "unfiltered")[1 to 10] > > This query also returns documents which do not have any word starts with > "A" in "title" element. > > I also tried by creating "element word lexicon" for title element, but > still same result. > > When I enabled "one character search" I got accurate response, > since this index is not recommended by MarkLogic (as three character > search and word lexicon with codepoint collation already enabled). > > Kindly suggest do I need to enable single character index or is there > any other alternative to achieve the same. > > Thanks and regards > Amit Dev > > -----Original Message----- > From: Mary Holstege [mailto:[email protected]] > Sent: Friday, March 14, 2014 3:56 AM > To: [email protected]; Amit Kumar Dev > Subject: Re: [MarkLogic Dev General] One character wild card search > without using filter search > > > > On Tue, 11 Mar 2014 20:53:52 -0700, Amit Kumar Dev > <[email protected]> wrote: > >> Hi All, >> >> >> * I am performing one character wild card search on title >> element. >> i.e. >> <cts:element-query> >> <cts:element>Title</cts:element> >> <cts:word-query weight="2"> >> <cts:text>D*</cts:text> >> <cts:option>wildcarded</cts:option> >> <cts:option>case-insensitive</cts:option> >> <cts:option>stemmed</cts:option> >> </cts:word-query> </cts:element-query> >> >> >> * I am performing unfiltered search. >> >> * Only Three & Two character wild card index is enable, but >> element word lexicon for Title is not created. >> >> After performing search I get documents which has Title with Diamond, >> Delegate etc.., but I am also getting documents which does not have any >> words starting with D in Title element. >> >> My queries are: >> >> * Is this behavior because of unfiltered search? >> >> * What is the best possible way to achieve one character wild >> card search without using filter search? > > Look at what xdmp:plan shows you for this query. Since you > don't have any index capable of resolving the D* part of it, > you will just be asking the index for all documents containing > Title elements. Unfiltered search is search using only the > indexes. > > In general we would recommend using 3 character plus a codepoint > word lexicon if you want to do wildcard queries. It may help to > add the trailing wildcard index as well. If you have the word > lexicon, the two-character index doesn't give you a lot. > > Also note that and element-query containing a word-query is > not the same as an element-word-query, and to accurately > resolve the former you will need element and word positions. > (Difference being: <book><Title><BREAK>Dog</BREAK></Title></book> > matches the element-query, but not the element-word-query > unless BREAK is declared as an element-word-query-through.) > > //Mary > > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended > solely > for the use of the addressee(s). If you are not the intended recipient, > please > notify the sender by e-mail and delete the original message. Further, > you are not > to copy, disclose, or distribute this e-mail or its contents to any > other person and > any such actions are unlawful. This e-mail may contain viruses. Infosys > has taken > every reasonable precaution to minimize this risk, but is not liable for > any damage > you may sustain as a result of any virus in this e-mail. You should > carry out your > own virus checks before opening the e-mail or attachment. Infosys > reserves the > right to monitor and review the content of all messages sent to or from > this e-mail > address. Messages sent to or from this e-mail address may be stored on > the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- Using Opera's revolutionary email client: http://www.opera.com/mail/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
