![]() |
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 |
Hi. You can set a robots.txt file with the following content:
Code:
# http://www.mywebsite.com/robots.txt |
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 |
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'/> |
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'> This problem is solved. Thanks a lot ! :D |
<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 |
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.
|
Quote:
|
All times are GMT -8. The time now is 08:12 PM. |
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.