Re: user feedback in solr

2010-02-05 Thread Tomas
I'm responding to this old mail becouse I implemented something like this 
similar to http://wiki.apache.org/solr/SolrSnmp . Maybe we could discuss if 
this is a good solution.

I'm using Solr 1.4 on a JBoss 4.0.5 and Java 1.5.
In my particular case, what I'm trying to find out is how often the user uses 
wildcards on his query.

I implemented a Servlet Filter that extracts the q parameter from the request 
and log it (to a diferent log file, just for querys). After that, the filter 
pases the query to the MBean, wich parses que query looking for wildcrds and 
that's it.
This is not a complete solution but it might help.
 What we are planning to do with this is to use de MBean to see live 
information, and to parse the query.log for a more detailed analysis of usage.

I put the following code on a jar file on the server's lib directory

-QueryFilter--

public class QueryFilter implements Filter {

private static final Log log = LogFactory.getLog(QueryFilter.class);

private QueryStatsMBean mbean;

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException 
{

if(request != null) {
String query = request.getParameter(q);
if(query != null) {
log.info(Query:  + query);
mbean.parseQuery(query);
}
}
chain.doFilter(request, response);
}

public void init(FilterConfig filterConfig) throws ServletException {
log.info(init filter  + this);

mbean = new QueryStats();
try {
mbean.create();
registerMBean(mbean.getName(), mbean);
} catch (Exception e) {
throw new
 ServletException(e);
}

}

private void registerMBean(String objectName, Object bean) throws 
ServletException {
MBeanServer mbs = MBeanServerLocator.locateJBoss();
try {
  ObjectName on = new ObjectName(objectName);
  mbs.registerMBean(bean, on);
  log.info(MBean registered);
}
catch (NotCompliantMBeanException e) { throw new 
ServletException(e); }
catch (MBeanRegistrationException e) { throw new 
ServletException(e); }
catch (InstanceAlreadyExistsException e) { throw new 
ServletException(e); }
catch (MalformedObjectNameException e) { throw new 
ServletException(e); }
  }


public void destroy() {
log.info(Destroying Filter + this);
mbean.destroy();
}

}

---QueryStatsMBean--

public interface QueryStatsMBean extends org.jboss.system.ServiceMBean {

public Integer
 getTotalQueries();

public Integer getAsteriskQueries();

public Integer getQuestionQueries();

public Integer getDefaultQueries();

public void parseQuery(String query);

public void create() throws Exception;

public void start() throws Exception;

public void stop();

public void destroy();

public int fileReaded();


}




QueryStats 

public class QueryStats implements QueryStatsMBean{

private Integer totalQueries;

private Integer asteriskQueries;

private Integer questionQueries;

private Integer defaultQueries;

public void create() throws Exception {
totalQueries = new Integer(0);

asteriskQueries = new Integer(0);
questionQueries = new Integer(0);
defaultQueries = new Integer(0);
}

public void parseQuery(String query) {
totalQueries =
 new Integer(totalQueries.intValue() + 1);
if(isDefaultQuery(query)) {
defaultQueries = new Integer(defaultQueries.intValue() 
+ 1);
}else {
if(hasAsterisk(query)) {
asteriskQueries = new 
Integer(asteriskQueries.intValue() + 1);
}
if(hasQuestion(query)) {
questionQueries = new 
Integer(questionQueries.intValue() + 1);
}
}
}

private boolean hasQuestion(String query) {
return query.indexOf(?) != -1;
}

private boolean hasAsterisk(String query) {
return query.indexOf(*) != -1;
}

private boolean isDefaultQuery(String defaultQuery) {
return *:*.equals(defaultQuery);
}

public Integer getTotalQueries() {
return totalQueries;
}


user feedback in solr

2009-06-10 Thread Pooja Verlani
Hi all,

I wanted to know if there is any provision to accommodate user feedback in
the form of query logs and click logs,
to improve the search relevance and ranking.
Also, is there a possibility of it being included in the next version ?

Thank you,
Regards,
Pooja


Re: user feedback in solr

2009-06-10 Thread Eric Pugh
You can look at the HTTP server logs output by Jetty (or whatever  
server you have) that provides a lot of visibility into what people  
are looking for.   However, there isn't that I know of a ready to  
roll analytics package for Solr   It would be cool though!


Eric


On Jun 10, 2009, at 8:28 AM, Pooja Verlani wrote:


Hi all,

I wanted to know if there is any provision to accommodate user  
feedback in

the form of query logs and click logs,
to improve the search relevance and ranking.
Also, is there a possibility of it being included in the next  
version ?


Thank you,
Regards,
Pooja


-
Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | 
http://www.opensourceconnections.com
Free/Busy: http://tinyurl.com/eric-cal