Results from ft:extract()
Monday, 2 December 2013 · 2 messages · last reply 3 Dec 2013
LJ
Lars Johnsen2 Dec 2013 20:30 #
Hello all
When using
ft:extract() on nodes, it seems to clip into the match itself too often. Is it possible to have ft:extract() leave as much before the match as after?
For example, here are two results for "spise lunsj" (= eat lunch (language is Norwegian)) the first is as it should be, while the second have half of the matched string clipped . The result is obtained first as a set of hits using fulltext search [text() contains text {$terms} all], then each hit is processed through ft:extract($hit, $terms):
... gjerne komme for å spise lunsj med meg på Harrods. Da skal jeg servere hjortetestikler fra eiendommen min i Skottland. Vi trenger nemlig alle store...
... de franske VM-spillerne hjem til Paris. Der ble de mottatt av fans både på Charles de Gaulle-flyplassen og da de ankom Elysee-palasset for å spise ...
Regards,
Lars G Johnsen
National Library of NorwayCG
Christian Grün3 Dec 2013 00:27 #
Hi Lars,
Quoted text · Lars Johnsen · 3 lines
> When using ft:extract() on nodes, it seems to clip into the match itself too > often. Is it possible to have ft:extract() leave as much before the match as > after?
the
ft:extract algorithm is an intricate one [1], as the inputs to be processed can be very manifold, but we can try to tweak it a little. Could you please provide us with a little sample XML and query?
Best,
Christian
PS: if you, or someone else, want to tweak the extract code.. We are always glad to receive patches!
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/util/DataFTBuilder.javaQuoted text · Lars Johnsen · 26 lines
> > For example, here are two results for "spise lunsj" (= eat lunch (language > is Norwegian)) the first is as it should be, while the second have half of > the matched string clipped . The result is obtained first as a set of hits > using fulltext search [text() contains text {$terms} all], then each hit is > processed through ft:extract($hit, $terms): > > ... gjerne komme for å spise lunsj med meg på Harrods. Da skal jeg servere > hjortetestikler fra eiendommen min i Skottland. Vi trenger nemlig alle > store... > > ... de franske VM-spillerne hjem til Paris. Der ble de mottatt av fans både > på Charles de Gaulle-flyplassen og da de ankom Elysee-palasset for å > spise... > > > > Regards, > Lars G Johnsen > National Library of Norway > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery