Hi Abishek,


What is happening here is that you pass ‘,’ as search term to a word-query
with ‘punctuation-insensitive’ option. That option causes the comma
character effectively to be stripped out of the search term, leaving an
empty search term. Doing a cts:word-query with an empty search term results
nothing.



I think you have few options:

1.      Don’t tokenize the search string yourself (at least, if that is
what you are doing), and pass in ‘metal,’ or ‘, metal’ as search term with
punctuation insensitive. That is effectively the same as searching for
‘metal’.

2.      Strip punctuation yourself before parsing it to <cts:query> element
structure (or post-process the query element structure to filter out
punctuation-only queries)

3.      Add <empty apply="all-results" /> to your search options (I’m
guessing you are using search:parse, so to the options you pass in there)



Kind regards,

Geert



*Van:* general-boun...@developer.marklogic.com [mailto:
general-boun...@developer.marklogic.com] *Namens *Abhishek53 S
*Verzonden:* woensdag 1 februari 2012 10:30
*Aan:* General MarkLogic Developer Discussion
*Onderwerp:* [MarkLogic Dev General] element-query with punctuation
insensitive and punctuation marks as cts:text




Hi Folks,

I am not sure if I am wrong somewhere while explaining this issue of
punctuation-insensitive search with punctuation marks as cts:text
(element-query). While executing the below query I am not getting any count
back because punctuation mark is not ignored during search (even if
punctuation-insensitive). The expected behavior of our application is
always punctuation-insensitive . If I remove word query with punctuation
marks, It will start returning count based on remaining search criteria. On
the other hand word query with punctuation-sensitive option is behaving
similar to it is ignored from the search criteria.


Please let me know how to make this element-query punctuation insensitive
even if punctuation marks are present into cts:text node of word-query .
xdmp:estimate(cts:search(fn:doc(),
                cts:query(
                    <*cts:element-query*>
                      <*cts:element* xmlns="">data</*cts:element*>
                            <*cts:and-query*>
                              <*cts:word-query*>
                                  <*cts:text* xml:lang="en">,</*cts:text*>
                                  <*cts:option*>case-insensitive</*
cts:option*>
                                  <*cts:option*>punctuation-insensitive</*
cts:option*>
                                  <*cts:option*>unstemmed</*cts:option*>
                               </*cts:word-query*>
                               <*cts:word-query*>
                                  <*cts:text* xml:lang="en">metal</*cts:text
*>
                                  <*cts:option*>case-insensitive</*
cts:option*>
                                  <*cts:option*>punctuation-insensitive</*
cts:option*>
                                  <*cts:option*>unstemmed</*cts:option*>
                               </*cts:word-query*>
                           </*cts:and-query*>
                    </*cts:element-query*>
               )))

Thanks & Regards
Abhishek Srivastav
Tata Consultancy Services
Cell:- +91-9883389968
Mailto: abhishek5...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to