Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@monitorjbl
Copy link
Contributor

Fixes #98

@monitorjbl
Copy link
Contributor Author

Any questions about this PR? The schema updates conflict with the fix for #116.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like to depend on a toString implementation, maybe there's something like Collectors.joining from java 8 (http://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.html#joining-java.lang.CharSequence-) in guava api that we can use?

@csokol
Copy link
Contributor

csokol commented Nov 3, 2014

sorry for the delay, besides that toString comment everything seems fine...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, there's a Guava utility that joins collections. I was just keeping to the original implementation, but I don't mind switching one bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you improve that now :-)

Chico Sokol

On Mon, Nov 3, 2014 at 3:59 PM, monitorjbl [email protected] wrote:

In src/main/java/org/mamute/search/SolrQuestionIndex.java:

  •   String answer = null;
    
  •   List<String> responses = new ArrayList<>();
    
  •   for (Answer a : q.getAnswers()) {
    
  •       if (a.isSolution()) {
    
  •           answer = a.getDescription();
    
  •       } else {
    
  •           responses.add(a.getDescription());
    
  •       }
    
  •   }
    
  •   if (answer != null) {
    
  •       doc.addField("answer", answer);
    
  •   }
    
  •   if (responses.size() > 0) {
    
  •       doc.addField("responses", responses.toString().replace("[", "").replace("]", ""));
    
  •   }
    

Sure, there's a Guava utility that joins collections. I was just keeping
to the original implementation, but I don't mind switching one bit.


Reply to this email directly or view it on GitHub
https://github.com/caelum/mamute/pull/114/files#r19751084.

@monitorjbl
Copy link
Contributor Author

Switched over to using Guava's Joiner utility.

@csokol
Copy link
Contributor

csokol commented Nov 3, 2014

Great! Thanks!

csokol added a commit that referenced this pull request Nov 3, 2014
Adding answers to solr indexing
@csokol csokol merged commit 2cec367 into caelum:master Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Solr indexing should use question body/answers

2 participants