David, although 3) would work, I think the easiest way to do it is to write a custom constraint that constructs a stemmed word query. There are good instructions for implementing a custom constraint in the Search Developer's Guide. I will say that there were some conveniences added (I think in 4.2) that made it easier to write custom constraints than in 4.1, so if you have the option of moving to a more recent version, that's worth considering.
--Colleen ________________________________________ From: [email protected] [[email protected]] On Behalf Of Steiner, David J. (LNG-DAY) [[email protected]] Sent: Wednesday, October 17, 2012 9:08 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Query on multiple language using search api (Geert Josten) Here’s a similar situation: Using 4.1, I have an unstemmed database. However the user searching it occasionally know she/he wants to search for the stemmed version of one of their terms. The “term” option applies to all terms in a document and the constraint would only apply to specific element(s) for value or word. I want to do something like allow: blue AND green AND stemmed:ran That is, I want to search the entire document for unstemmed versions of “blue” and “green” and the stemmed version of “ran.” However, I’m not really seeing how to construct that constraint without simply listing all elements of a document in the constraint. <options xmlns="http://marklogic.com/appservices/search"> <constraint name="stemmed"> <word> <term-option>stemmed</term-option> <element name="my-element1"/> </word> <word> <term-option>stemmed</term-option> <element name="my-element2"/> </word> … </constraint> Which actually appears to not be allowed – you can only get one element in word or only one word in a constraint (even though check-options gives no error). When I try this I get: [1.0-ml] XDMP-ARGTYPE: (err:XPTY0004) fn:QName("", (xs:NCName("my-element1"), xs:NCName("my-element2"))) -- arg2 is not of type xs:string So, 1) Does this even work, perhaps in a later version of ML? 2) Is there a better/easier way to do what I’m trying to do? 3) I suppose I could create a field that is made up of every element then use that field in the constraint? Thanks, David From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: Friday, August 17, 2012 9:37 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Query on multiple language using search api (Geert Josten) Hi Amit, >From what I read in the docs, the <term> option (which is one of two that >allows <term-option>s, <constraint> being the other) is not to apply >term-options generally, but specifically for unconstraint searches. So, if you >search for something like: foo or xx:bar Then the term-options within <term> are applied to ‘foo’. The term-options within <constraint name=”xx”> are applied to ‘bar’.. Kind regards, Geert Van: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] Namens amit gope Verzonden: vrijdag 17 augustus 2012 14:54 Aan: [email protected]<mailto:[email protected]> Onderwerp: Re: [MarkLogic Dev General] Query on multiple language using search api (Geert Josten) Hi Geert, My search options has almost 20 constraints and when i add the term option as unstemmed to be common for all the constaints it doesn't work, but when i provide the term-option value unstemmed to individual constraints then it works, why this is happening, is this a feature of search api to provide separate term option? -- Regards Amit On 17 August 2012 00:30, <[email protected]<mailto:[email protected]>> wrote: Send General mailing list submissions to [email protected]<mailto:[email protected]> To subscribe or unsubscribe via the World Wide Web, visit http://developer.marklogic.com/mailman/listinfo/general or, via email, send a message with subject or body 'help' to [email protected]<mailto:[email protected]> You can reach the person managing the list at [email protected]<mailto:[email protected]> When replying, please edit your Subject line so it is more specific than "Re: Contents of General digest..." Today's Topics: 1. Natural language version of a query? (Tim Finney) 2. Query on multiple language using search api (amit gope) 3. Re: Natural language version of a query? (Geert Josten) 4. Re: Query on multiple language using search api (Geert Josten) 5. Local-disk forest failover (Danny Sinang) 6. Re: Local-disk forest failover (Michael Blakeley) 7. Re: Local-disk forest failover (Wayne Feick) ---------- Forwarded message ---------- From: Tim Finney <[email protected]<mailto:[email protected]>> To: [email protected]<mailto:[email protected]> Cc: Date: Wed, 15 Aug 2012 18:29:12 -0300 Subject: [MarkLogic Dev General] Natural language version of a query? Hi All, Has anyone here tried to produce a natural language equivalent of a search string or the kind used in search:search? As an example, here is an imaginary search string: cat OR dog (author:"Smith, John" OR author:"Jones, Thomas") date-after:1984-03-01 date-before:1991-05-31 I'd like to end up with something like this: cat OR dog with authors "Smith, John" OR "Jones, Thomas" AND after 1984-03-01 AND before 1991-05-31 (Things are complicated by parentheses, NEAR, NOT, ...) Are there any built-in functions for doing such a thing? Best, Tim Finney ---------- Forwarded message ---------- From: amit gope <[email protected]<mailto:[email protected]>> To: [email protected]<mailto:[email protected]> Cc: Date: Thu, 16 Aug 2012 11:42:18 +0530 Subject: [MarkLogic Dev General] Query on multiple language using search api Hello All, Can anyone please help me out queering on multiple languages using search api. In my database i have documents of different languages (en, de, fr) to name a few. Currently when i do not provide any language specification it returns me contents from only english. How do i mention the language constraint to include the search for languages de and fr as well? Regards Amit ---------- Forwarded message ---------- From: Geert Josten <[email protected]<mailto:[email protected]>> To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Cc: Date: Thu, 16 Aug 2012 10:22:13 +0200 Subject: Re: [MarkLogic Dev General] Natural language version of a query? Hi Tim, There is a grammar option in search:search options, but haven't looked into that myself yet. Perhaps the documentation can make clear whether you can use that or not. Alternative is to pre-process the search query yourself. You can try to tackle it with regex, but it might be more fun to write a grammar for it and use the handy site maintained by Gunther Rademacher to generate XQuery code out of it: http://www.bottlecaps.de/rex/ Kind regards, Geert -----Oorspronkelijk bericht----- Van: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] Namens Tim Finney Verzonden: woensdag 15 augustus 2012 23:29 Aan: [email protected]<mailto:[email protected]> Onderwerp: [MarkLogic Dev General] Natural language version of a query? Hi All, Has anyone here tried to produce a natural language equivalent of a search string or the kind used in search:search? As an example, here is an imaginary search string: cat OR dog (author:"Smith, John" OR author:"Jones, Thomas") date-after:1984-03-01 date-before:1991-05-31 I'd like to end up with something like this: cat OR dog with authors "Smith, John" OR "Jones, Thomas" AND after 1984-03-01 AND before 1991-05-31 (Things are complicated by parentheses, NEAR, NOT, ...) Are there any built-in functions for doing such a thing? Best, Tim Finney _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general ---------- Forwarded message ---------- From: Geert Josten <[email protected]<mailto:[email protected]>> To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Cc: Date: Thu, 16 Aug 2012 10:25:46 +0200 Subject: Re: [MarkLogic Dev General] Query on multiple language using search api Hi Amit, Haven’t tried, but you should be able to add <term-option>lang=en</term-option><term-option>lang=de</term-option><term-option>lang=fr</term-option> to the relevant constraint.. Kind regards, Geert PS: I’m wondering whether it would also accept lang=en,de,fr, but the docs don’t seem to indicate so.. Van: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] Namens amit gope Verzonden: donderdag 16 augustus 2012 8:12 Aan: [email protected]<mailto:[email protected]> Onderwerp: [MarkLogic Dev General] Query on multiple language using search api Hello All, Can anyone please help me out queering on multiple languages using search api. In my database i have documents of different languages (en, de, fr) to name a few. Currently when i do not provide any language specification it returns me contents from only english. How do i mention the language constraint to include the search for languages de and fr as well? Regards Amit ---------- Forwarded message ---------- From: Danny Sinang <[email protected]<mailto:[email protected]>> To: general <[email protected]<mailto:[email protected]>> Cc: Date: Thu, 16 Aug 2012 11:00:54 -0400 Subject: [MarkLogic Dev General] Local-disk forest failover Hi, When a local-disk failover happens, will the replica forest (which just became the primary forest) need to reindex ? Also, will the surviving cluster node try to replicate the new forest to some other cluster members ? Regards, Danny ---------- Forwarded message ---------- From: Michael Blakeley <[email protected]<mailto:[email protected]>> To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Cc: Date: Thu, 16 Aug 2012 10:23:30 -0700 Subject: Re: [MarkLogic Dev General] Local-disk forest failover No on both questions. Forest replication is just like RAID-1. You set up the mirrors, and they are exact copies. This underscores the importance of monitoring. You want to find out about a forest failure immediately - not weeks later, when the replica fails and the whole database goes offline. -- Mike On 16 Aug 2012, at 08:00 , Danny Sinang wrote: > Hi, > > When a local-disk failover happens, will the replica forest (which just > became the primary forest) need to reindex ? > > Also, will the surviving cluster node try to replicate the new forest to some > other cluster members ? > > Regards, > Danny > > > _______________________________________________ > General mailing list > [email protected]<mailto:[email protected]> > http://developer.marklogic.com/mailman/listinfo/general ---------- Forwarded message ---------- From: Wayne Feick <[email protected]<mailto:[email protected]>> To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Cc: Date: Thu, 16 Aug 2012 10:33:39 -0700 Subject: Re: [MarkLogic Dev General] Local-disk forest failover A slight refinement; replicas are equivalent copies rather than exact copies. You'll have the same fragments, but likely organized differently into stands. Wayne Michael Blakeley <[email protected]<mailto:[email protected]>> wrote: No on both questions. Forest replication is just like RAID-1. You set up the mirrors, and they are exact copies. This underscores the importance of monitoring. You want to find out about a forest failure immediately - not weeks later, when the replica fails and the whole database goes offline. -- Mike On 16 Aug 2012, at 08:00 , Danny Sinang wrote: > Hi, > > When a local-disk failover happens, will the replica forest (which just > became the primary forest) need to reindex ? > > Also, will the surviving cluster node try to replicate the new forest to some > other cluster members ? > > Regards, > Danny > > > _______________________________________________ > General mailing list > [email protected]<mailto:[email protected]> > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
