Re: How to implement this idea




rossum wrote:
On 9 Oct 2006 02:48:34 -0700, sticker.ji@xxxxxxxxx wrote:

I have a dataset which contains records. The record can be treated as a
set, which contains elements with no duplication.

The query is a pair of elements. The system should return all the
records containning both of the elements.

How to implement this function quickly?

Example:

dataset:
record 1: {A B D F G}
I assume you meant C instead of G
record 1: {A B D F C}

record 2: {A C T Y}
record 3: {B C D Q L}

query {B C} returns 1, 3.
query {A F} return 1.
query {A H} return null.

The query will always be a pair of elements. No other format of query
exists.

Thank you very much for your idea.

Set up an inverted index:

element A: {r1 r2}
element B: {r1 r3}
element C: {r1 r2 r3}
element D: {r1 r3}
element E: {}
element F: {r1}

Retrieve the entries for the given two elements and return the
intersection of the two returned sets.

rossum

that's surely fastest way, but it is also a hungriest. such index will
occupy much more space than dataset itself.

.



Relevant Pages

  • Re: How to implement this idea
    ... rossum wrote: ... The query is a pair of elements. ... Set up an inverted index: ... If the dataset is sparse then I would not store empty pointers. ...
    (comp.programming)
  • Re: How to implement this idea
    ... rossum wrote: ... The query is a pair of elements. ... Set up an inverted index: ... then if you will not store empty pointers, ...
    (comp.programming)
  • Re: How to implement this idea
    ... rossum wrote: ... The query is a pair of elements. ... records containning both of the elements. ... Set up an inverted index: ...
    (comp.programming)
  • Re: How to implement this idea
    ... which contains elements with no duplication. ... The query is a pair of elements. ... records containning both of the elements. ...
    (comp.programming)
  • Re: Boolean Query Algorithm
    ... An inverted index contains both a "dictionary" and a location list. ... To resolve the query for consecutive words like "inverted index" ... I have a question relating to how search engines and (in fact ...
    (comp.infosystems.search)