Hi Rob, ok thanks for your quickly reply.
in this case then when you say "REGEX has absolutely no relation to Lucene," means maybe "*FILTER ** *has absolutely no relation to Lucene"? 2013/10/7 Rob Vesse <[email protected]> > No, as Andy explained they are two completely different mechanisms > > REGEX has absolutely no relation to Lucene, it is a part of standard > SPARQL and causes the query engine to have to evaluate the regular > expression for every possible solution returned by the inner portion of > the query to decided whether to retain that solution or not. > > Text querying uses a Lucene index and so can pick out only solutions that > satisfy some Lucene query and so is substantially more performant. > > In the example given your FILTER clause is superfluous since the text > query ensures that only subjects which satisfy the text query are matched > so having the FILTER as well is doing unnecessary work over the possible > solutions produced by the text query. > > Rob > > On 10/7/13 1:54 PM, "Andrea Dessi" <[email protected]> wrote: > > >Thank you Andy for your previously reply. > > > >My doubts born for example in this query > > > > > >SELECT DISTINCT ?s > > > >WHERE > > > >{ > > > >*?s text:query (dbpprop:type 'Daily newspaper')* . > > > >?s dbpprop:type ?v1 . > > > >*FILTER ( REGEX(STR(?v1), "Daily newspaper" , "i") )* > >} > > > > > >Lucene indexes work together (one Lucene query) or not? > > > >Thanks again > > > >-- > >Andrea. > > > > > >2013/10/5 Andy Seaborne <[email protected]> > > > >> On 05/10/13 08:45, Andrea Dessi wrote: > >> > >>> Hi, > >>> > >>> I've got jena-text working to do Lucene indexing, and I'd like to know > >>>the > >>> technical differences between text:query and filter regex. > >>> > >>> Thanks for any help, > >>> > >>> Andrea > >>> > >>> > >> Hi Andrea, > >> > >> I'm not sure what aspect you mean but > >> > >> text:query is a property function - it looks like part of the basic > >>graph > >> pattern and it can generate answers, binding variables. A filter can > >>not > >> do that - all it can do is take a stream of possibilities and accept or > >> reject them. Optimizers may do magic things in certain cases but, in > >> general, it is a case of generating all possibilities which may may be a > >> huge amount of work, and reducing it to a few results. That's why > >>FILTER > >> regex can be very expensive. > >> > >> The lucene (or Solr) index used by text:query only generate the possible > >> matches because, being an index, the Lucene engine looks up the query > >> string (or some part of) to find a moderate number of possibilites. > >>There > >> is no "get everything and reduce" effect. > >> > >> Andy > >> > >> > > > > > >-- > >Andrea Dessi > > > > > -- Andrea Dessi
