PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > How-to Forum

Reply
 
Thread Tools
Old 01-07-2004, 08:54 AM   #1
laurentxav
Green Mole
 
Join Date: Jan 2004
Location: Belgium
Posts: 11
Search in specific directory

Hello,

I've a problem searching with PhpDig...
I'm working on a very big website which is subdivised into 7 departments. Is it possible to limit the search to a single department ? (wich is located in a specific directory)

For example :

http://www.mywebsite.com/ is the main website

the departments are located in :

http://www.mywebsite.com/Dep1/
http://www.mywebsite.com/Dep2/
http://www.mywebsite.com/Dep3/
...

and PhpDig is located in :
http://www.mywebsite.com/PhpDig/

How to search Dep2 ?

Many thanks.

Laurent
laurentxav is offline   Reply With Quote
Old 01-07-2004, 01:51 PM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. You can set a robots.txt file with the following content:
Code:
# http://www.mywebsite.com/robots.txt

User-agent: PhpDig
Disallow: /Dep1
Disallow: /Dep3
Disallow: /Dep4

# and so forth
If you already crawled these directories, you can exlude and delete them from the control panel.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 01-07-2004, 06:38 PM   #3
laurentxav
Green Mole
 
Join Date: Jan 2004
Location: Belgium
Posts: 11
Ok, but it's not the problem... Sorry but my english isn't very perfect, I'm french-speaking !

Mywebsite is a complete site including all departments. PhpDig must crawl all available departments. But, when a visitor is surfing department 2 and use PhpDig for searching for something, I would like PhpDig return results located only into the department surfed by the visitor (the 2nd in this case).

So, for example, if the search query has results in many departments but the visitor is surfing department 2, i'd like to shown results for department 2 only.

A solution would be to install PhpDig in each directory, to create databases as much as necessary and to index and crawl each directory (department) separately. But this is a little complicated. Is there another possibility to ask PhpDig returning results in selected directory and not in the full indexed site ?

Thanks
laurentxav is offline   Reply With Quote
Old 01-08-2004, 01:16 AM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. Perhaps you could dynamically create the search form and among the input tags of type hidden use the following:
Code:
<input type='hidden' name='site' value='NUMBER'/>
<input type='hidden' name='path' value='REL/PATH/'/>
<input type='hidden' name='refine' value='1'/>
Depending on what page a user in on, dynamicaly replace NUMBER with the site number, dynamically replace REL/PATH/ with the relative path to a department, and keep the refine hidden tag with value one unchanged. The NUMBER can be found in the site_id column of the sites table.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 01-08-2004, 02:34 AM   #5
laurentxav
Green Mole
 
Join Date: Jan 2004
Location: Belgium
Posts: 11
Hi!

It works perfectly.

But we must be carefull, if I want to search the directory and all subdirectories, I must add a "%".
So, for example, the code is :

Code:
<input type='hidden' name='site' value='1'>
<input type='hidden' name='path' value='Dep2/%'>
<input type='hidden' name='refine' value='1'>
So PhpDig'll show all result in "Dep2" directory and all sub-directories.

This problem is solved. Thanks a lot !
laurentxav is offline   Reply With Quote
Old 05-05-2004, 10:30 PM   #6
zaartix
Orange Mole
 
Join Date: May 2004
Location: russia, samara
Posts: 56
<input type='hidden' name='path' value='Dep2/%'>

this is dangerous string. What if "hacker" add into this string code:

<input type='hidden' name='path' value='Dep2/%"; drop table ha-ha; "'> or something else
zaartix is offline   Reply With Quote
Old 12-08-2004, 01:13 PM   #7
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Update: With PhpDig 1.8.3+ you can crawl within a certain directory if LIMIT_TO_DIRECTORY is set to true in the config file, so only crawl those directories you want to search. Note the comments in the config file when using this option. Also, if you do not want the dropdown on the search menu, then set DISPLAY_DROPDOWN to false in the config file.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 01-04-2005, 09:34 AM   #8
JunkMale
Green Mole
 
Join Date: Jan 2005
Posts: 1
Quote:
Originally Posted by zaartix
<input type='hidden' name='path' value='Dep2/%'>

this is dangerous string. What if "hacker" add into this string code:

<input type='hidden' name='path' value='Dep2/%"; drop table ha-ha; "'> or something else
I would expect the PhpDig code to contain an AddSlashes to avoid such a problem.
JunkMale is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to limit indexing to a specific directory? Beans How-to Forum 1 08-15-2005 11:03 AM
Specific Directory Search kh44na How-to Forum 3 04-01-2004 05:52 AM
Search in specific directory tams Troubleshooting 1 03-15-2004 03:08 AM
exclude specific directory from searching rasputin How-to Forum 1 01-29-2004 08:02 PM
Search in specific directory ONLY? mrfuches How-to Forum 6 01-23-2004 12:06 AM


All times are GMT -8. The time now is 10:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.