You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Clemens Wyss DEV <cl...@mysign.ch> on 2015/01/12 09:40:00 UTC

howto: handle temporal visibility of a document?

We have documents that are not always visible (visiblefrom-visibleto). In order to not have to query the originating object of the document whether it is currently visible (after the query), we'd like to put metadata into the documents, so that the visibility can be determined at query-time (by the query itself or a query filter). Any suggestions on how to index and query this metadata?

AW: AW: howto: handle temporal visibility of a document?

Posted by Clemens Wyss DEV <cl...@mysign.ch>.
Thx, I will simplify/optimize ;)

-----Ursprüngliche Nachricht-----
Von: Michael Sokolov [mailto:msokolov@safaribooksonline.com] 
Gesendet: Montag, 12. Januar 2015 14:41
An: java-user@lucene.apache.org
Betreff: Re: AW: howto: handle temporal visibility of a document?

The basic idea seems sound, but I think you can simplify that query a bit.  For one thing, the *:* clauses can be removed in a few places: 
also if you index an explicit null value you won't need them at all; for visiblefrom, if you don't have a from time, use 0, for visibleto, if you don't have a to time, use maxlong.

-Mike

On 1/12/15 4:23 AM, Clemens Wyss DEV wrote:
> I'll add/start with my proposal ;)
>
> Document-meta fields:
> + visiblefrom [long]
> + visibleto [long]
>
> Query or query filter:
> (*:* -visiblefrom:[* TO *] AND -visibleto:[* TO *]) OR (*:* 
> -visiblefrom:[* TO *] AND visibleto:[ <now in ms> TO *]) OR (*:* 
> -visibleto:[ * TO *] AND visiblefrom:[* TO <now in ms>]) OR ( 
> visiblefrom:[* TO <now in ms>] AND visibleto:[ <now in ms> TO *])
>
> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss DEV [mailto:clemensdev@mysign.ch]
> Gesendet: Montag, 12. Januar 2015 09:40
> An: java-user@lucene.apache.org
> Betreff: howto: handle temporal visibility of a document?
>
> We have documents that are not always visible (visiblefrom-visibleto). In order to not have to query the originating object of the document whether it is currently visible (after the query), we'd like to put metadata into the documents, so that the visibility can be determined at query-time (by the query itself or a query filter). Any suggestions on how to index and query this metadata?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: AW: howto: handle temporal visibility of a document?

Posted by Michael Sokolov <ms...@safaribooksonline.com>.
The basic idea seems sound, but I think you can simplify that query a 
bit.  For one thing, the *:* clauses can be removed in a few places: 
also if you index an explicit null value you won't need them at all; for 
visiblefrom, if you don't have a from time, use 0, for visibleto, if you 
don't have a to time, use maxlong.

-Mike

On 1/12/15 4:23 AM, Clemens Wyss DEV wrote:
> I'll add/start with my proposal ;)
>
> Document-meta fields:
> + visiblefrom [long]
> + visibleto [long]
>
> Query or query filter:
> (*:* -visiblefrom:[* TO *] AND -visibleto:[* TO *])
> OR (*:* -visiblefrom:[* TO *] AND visibleto:[ <now in ms> TO *])
> OR (*:* -visibleto:[ * TO *] AND visiblefrom:[* TO <now in ms>])
> OR ( visiblefrom:[* TO <now in ms>] AND visibleto:[ <now in ms> TO *])
>
> -----Ursprüngliche Nachricht-----
> Von: Clemens Wyss DEV [mailto:clemensdev@mysign.ch]
> Gesendet: Montag, 12. Januar 2015 09:40
> An: java-user@lucene.apache.org
> Betreff: howto: handle temporal visibility of a document?
>
> We have documents that are not always visible (visiblefrom-visibleto). In order to not have to query the originating object of the document whether it is currently visible (after the query), we'd like to put metadata into the documents, so that the visibility can be determined at query-time (by the query itself or a query filter). Any suggestions on how to index and query this metadata?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


AW: howto: handle temporal visibility of a document?

Posted by Clemens Wyss DEV <cl...@mysign.ch>.
I'll add/start with my proposal ;)

Document-meta fields:
+ visiblefrom [long]
+ visibleto [long]

Query or query filter:
(*:* -visiblefrom:[* TO *] AND -visibleto:[* TO *]) 
OR (*:* -visiblefrom:[* TO *] AND visibleto:[ <now in ms> TO *]) 
OR (*:* -visibleto:[ * TO *] AND visiblefrom:[* TO <now in ms>]) 
OR ( visiblefrom:[* TO <now in ms>] AND visibleto:[ <now in ms> TO *])

-----Ursprüngliche Nachricht-----
Von: Clemens Wyss DEV [mailto:clemensdev@mysign.ch] 
Gesendet: Montag, 12. Januar 2015 09:40
An: java-user@lucene.apache.org
Betreff: howto: handle temporal visibility of a document?

We have documents that are not always visible (visiblefrom-visibleto). In order to not have to query the originating object of the document whether it is currently visible (after the query), we'd like to put metadata into the documents, so that the visibility can be determined at query-time (by the query itself or a query filter). Any suggestions on how to index and query this metadata?