Re: Query for search engine
From: Michael C (me_at_mine.com)
Date: 01/21/05
- Next message: philippe.leblond_at_biodiv.org: "Re: Copy a record in the same table."
- Previous message: Phlip: "Query Help...please"
- In reply to: Ray: "RE: Query for search engine"
- Next in thread: Michael C: "Re: Query for search engine"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 21 Jan 2005 15:09:09 -0500
Try this:
SELECT i1.iPageID
FROM iTable i1
INNER JOIN iTable i2
ON i1.iPageID = i2.iPageID
WHERE i1.sPhrase LIKE '%searchword1%'
AND i2.sPhrase LIKE '%searchword2%'
Keep in mind that LIKE '%xxx%' is going to be a performance-killer,
especially twice in one query, since it won't be able to effectively take
advantage of indexes - on any system as far as I know.
Thanks
Michael C#, MCDBA
"Ray" <Ray@discussions.microsoft.com> wrote in message
news:5D31C6FA-6105-4711-A23F-0E8ABC493698@microsoft.com...
> Sample data:
> iParseID iPageID sPhrase
iRank
> 22592 daacf052-122a-446b-99c4-ead865dd468f home 33
> 22593 2cb2ebf2-4268-498a-9128-d223f09253e7 page 43
> 22594 2cb2ebf2-4268-498a-9128-d223f09253e7 home 15
> 22595 588e6a38-5f0e-4704-87f5-e5d17f6033f0 trade 24
> 22596 e51b431c-4b29-4316-8f45-0ac24b8fc812 home 23
> 22597 daacf052-122a-446b-99c4-ead865dd468f london 51
>
> When I do a search for "london home" then I only want the iPageID of
record
> 22597 returned and not for 22594 nor 22596.
>
> Both records 22594 and 22596 has "home" as a value for sParse, but there
are
> no other records where the iPageID is the same as for records 22594 and
22596
> and has "london" as the value for sPhrase.
>
> I hope this makes sence.
>
> I am trying to create a solution where the database can be ported to any
> relational database and is not restricted to SQL server. We use Access on
> our internet site and SQL for our intranet sites. It is therefore
> impractical to develop purely using Full Text Indexing.
>
> Thanks
> Ray
>
>
> "Alejandro Mesa" wrote:
>
> > I think the logical operator AND in the where clause is doing it. If
not,
> > Could you please post some DDL, sample data and expected result?
> >
> >
> >
> > AMB
> >
> >
> >
> > "Ray" wrote:
> >
> > > I have created an indexing service that populates a details table with
the
> > > stripped out phrases from the web pages.
> > >
> > > The details table has a few fields including:
> > > iParseID int (primary key)
> > > iPageID string
> > > sPhrase string
> > > iRank int
> > >
> > > The iPageID field contains a GUID value that forms the relationship
with the
> > > master table.
> > >
> > > sPhrase contains the keywords/phrases that were stripped out of the
web page.
> > >
> > > I need to select the iPageID where sPhrase contains the search words.
I
> > > know the syntax will be something like:
> > >
> > > SELECT iPageID FROM tbParse WHERE sPhrase LIKE '%searchword1%' and
sPhrase
> > > LIKE '%searchword2%' ORDER BY iRank
> > >
> > > The question is how can I only get the records where searchword1 and
> > > searchword2 are on? I don't want iPageID returned if only one of the
values
> > > are present.
> > >
- Next message: philippe.leblond_at_biodiv.org: "Re: Copy a record in the same table."
- Previous message: Phlip: "Query Help...please"
- In reply to: Ray: "RE: Query for search engine"
- Next in thread: Michael C: "Re: Query for search engine"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|