首页 \ 问答 \ 当q = 时,Solr返回所有结果(Solr return all results when q=)

当q = 时,Solr返回所有结果(Solr return all results when q=)

我正在使用PHP Codeigniter框架solr-php-client来构建搜索应用程序。

我有两页 -

  1. 只有一个输入框的搜索页面
  2. 结果页面,当用户在搜索页面中输入搜索词时,将显示结果

问题是,除非我输入一个搜索词, solr-php-client没有返回任何结果,而且url只是"http://localhost:8080/search/?q=" ,它不会做任何事情。 但是当我输入一个搜索词,例如“apple”作为例如,它会重定向到结果页面而没有任何问题,并且网址变为"http://localhost:8080/rdsearch/?q=apple"

我想要实现的是 - 当用户在搜索页面中输入搜索词或q为空时,如"http://localhost:8080/search/?q=" ,它应该直接指向结果页面并显示所有结果(类似于solr查询*:*


I am using PHP Codeigniter framework with solr-php-client to build a search application.

I have two pages -

  1. a search page with just a single input box
  2. a results page which will display results when user enters a search term in search page

The issue is, unless I enter a search term solr-php-client is not returning any results and for which the url would just be "http://localhost:8080/search/?q=" and it wont do anything. But when I enter a search term such as "apple" as an eg., it redirect to results page with matching results without any issue and the url becomes "http://localhost:8080/rdsearch/?q=apple"

What I would like to achieve is - When user does not enter a search term in the search page or when q is empty as in "http://localhost:8080/search/?q=", it should simply direct to results page and show all the results (similar to a solr query *:*)


原文:https://stackoverflow.com/questions/21272577
更新时间:2024-03-15 11:03

最满意答案

TorCtl控制Tor; 您仍然需要配置urllib以使用代理。 阅读文档 ; 您可能更喜欢在[, proxies]为您的情况设置环境变量。

以下是如何使用proxies

proxies = {'http': 'http://localhost:9050/'}
ip = urllib.urlopen('http://hypersource.net78.net/autos/ip.php', proxies=proxies).read()

如果您正在使用任何其他协议(例如,HTTPS),请在proxies指定它。


TorCtl controls Tor; you still need to configure urllib to use a proxy. Read the documentation; you might prefer just setting environment variables over [, proxies] for your situation.

Here’s how to use proxies, though:

proxies = {'http': 'http://localhost:9050/'}
ip = urllib.urlopen('http://hypersource.net78.net/autos/ip.php', proxies=proxies).read()

If you’re using any other protocol (for example, HTTPS), specify that in proxies too.

相关问答

更多
  • 如何使用tor?[2024-01-17]

    tor官网已经不能直接打开了16楼下的应该是linux的或源码包,win下要下exe的。
  • 匿名解释了这个套接字覆盖,答案几乎完美,除非你必须关闭控制套接字 。 由于TorCtl事件循环会更安全,但我必须深入了解TorCtl代码以了解此事件循环。 总结你的代码变成: from TorCtl import TorCtl import socks import socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050) import urllib2 import sqlite3 from BeautifulSou ...
  • 我删除了SSL和FTP代理和端口设置,它工作正常。 我还使用了端口9150。 这是工作代码: import stem.process from stem import Signal from stem.control import Controller from splinter import Browser proxyIP = "127.0.0.1" proxyPort = 9150 proxy_settings = {"network.proxy.type":1, "network.prox ...
  • 由于垃圾邮件发送者的滥用,许多Tor出口节点拒绝发送端口25(SMTP)流量,因此您可能会遇到问题。 Because of abuse by spammers, many Tor egress nodes decline to emit port 25 (SMTP) traffic, so you may have problems.
  • 问题非常简单,当您使用silvertunnel API时,您不需要在URL中指定协议,因此只需删除http://修复错误。 尝试以下方法 //remove http:// String remoteHostname = "test.silvertunnel.com"; The problem is quite simple, when you use the silvertunnel API you dont need to specify the p ...
  • TorCtl控制Tor; 您仍然需要配置urllib以使用代理。 阅读文档 ; 您可能更喜欢在[, proxies]为您的情况设置环境变量。 以下是如何使用proxies : proxies = {'http': 'http://localhost:9050/'} ip = urllib.urlopen('http://hypersource.net78.net/autos/ip.php', proxies=proxies).read() 如果您正在使用任何其他协议(例如,HTTPS),请在proxies ...
  • 我在完成Meteor之后导入Communicator解决了这个问题,就在我在Communicator中调用方法之前。 from MeteorClient import MeteorClient client = MeteorClient('ws://127.0.0.1:3000/websocket') client.connect() def subscription_callback(error): if error: print(error) client.subscrib ...
  • 你没有犯错。 该输出表明Tor已启动,已连接到网络并正在运行。 你可能想知道如何守护它,或者在后台运行它( nohup tor & )。 Opening Socks listener on 127.0.0.1:9050行告诉您它的SOCKS(代理)端口正在侦听端口9050.这是您想要curl或wget等应用程序代理的端口。 如您链接的文章所示,您只需使用Tor的SOCKS端口运行curl。 curl -s —socks5-hostname 127.0.0.1:9050 http://www.showmyip ...
  • 我想你应该这样做 conn.send_signal("NEWNYM") 您可以尝试在通话之间打印conn。 看看它是否是无。 也许连接失败了。 I think you should do conn.send_signal("NEWNYM") You could try printing conn in between the calls. See if it's None. Maybe the connection failed.
  • 答案: 首先,打开Tor浏览器(它需要已经运行)。 然后,在您的代码中,确保只需从以下开始: Selenium::WebDriver::Firefox::Binary.path='{location of start_tor_browser*}' browser = Watir::Browser.new :firefox *在我的情况下:/ home / tor / tor-browser_en-US / start-tor-browser 不需要其他任何东西 - 不要打扰乱码 The answer: F ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)