PDF and Word docs

jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

We have a lot of PDF and Word documents on our site. When users carry out a search lots of these files are returned.
Is it possible somehow to ignore these documents when carrying out a search?
A search string something like this: "bus time tables -pdf -doc"

Thanks,

Jan
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

PDF and Word docs

Post by mark »

Normally if you don't want something in the search results you wouldn't walk it. Remove those extensions from the allowed list in the walk settings.

If you want them in the database but only sometimes don't want to search them you could modify the search script slightly to add something like
and Url not like $unq
after
and Url matches $uq
Then set unq to something like "pdf doc".
You'd also need to do the same with unq as is done with uq, export it at the top, and check it in fpar.
jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

Very good, works really well!

Thanks

Jan
jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

but.....

$indexcount doesn't get updated with the correct number of returned documents.
It still returns the number of docs found as if it was searching through the doc/pdf files.

Thank you!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

PDF and Word docs

Post by mark »

Did you add
<if $unq ne ""><$count=1></if>
to fpar as hinted to above?
jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

I have to admit that I hadn't done that, but even with it now it's still not working.

I have now added:
1.
<IF $word ne "">
<$unq = "doc" "pdf">
</IF>
(where $word comes from a check box)
2.
and Url not like $$unq
(in $sql)
3.
<if $unq ne ""><$count=1></if>
4.
<EXPORT $unq QUERY USEROK><!-- exclude DOC/PDFs -->

Would it be useful if I sent you the search file?
Thank again!
Jan
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

PDF and Word docs

Post by mark »

Does 1 get executed before 3?
Simple way to find out would be to temporarily add some prints:

<IF $word ne "">
<$unq = "doc" "pdf">{set unq}
</IF>

<if $unq ne ""><$count=1></if>{checked unq}
jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

No, 3 gets executed first and then 1.
{checked unq} {set unq} is the result when carrying out a search with the Word/pdf box checked, and
{checked unq} is the result with the box unchecked.

So, the pdf/word filter works fine but instead of the 3 documents which it is showing, it's actually saying it has found 19! Which would have been correct if I had searched all documents (including pdf and word).
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

PDF and Word docs

Post by mark »

Move 1 so that it happens before 3. It should be in the fpar function, somewhere before 3.
jan.punter
Posts: 54
Joined: Thu Jan 16, 2003 9:17 am

PDF and Word docs

Post by jan.punter »

What a fantastic resource this is with very speedy responses. I'm impressed and recommend Webinator to all my colleagues.

Thanks Mark, that works OK but as it retrieves the proper value of $indexcount whilst the searching is carried I'll have to amend my text at the top of the page (with search results).

Currently I'm using this inside NAME=showform:

<IF $query ne "">
<FS>You searched for "<b>$query</b>"
<IF $indexcount gt 0>
- $indexcount results were found.<br><br>
<ELSE>
<p><b>No results found, please try again...</b>
</p>
</IF>
</IF>

Any ideas? It's not a massive problem as it already shows the proper nr of documents found at the top of the Search Result Summary but it's a 'nice to have'.

Thanks.
Post Reply