Using Solrj (querying and indexing)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















eWorking on a Natural language processing project using Solr.



I am a complete amateur in relation to Solr, So keep that in mind please. I started a solr server using cmd:



 Solr.cmd Start -e techproducts


then I tried querying using SolrJ



public class SolrJ {
public static void main(String args) throws SolrServerException, IOException {
SolrClient client = new Builder("http://localhost:8983/solr/#").build();
QueryResponse response = client.query(new SolrQuery("*:*"));
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
System.out.println(results.get(i));
}
}
}


When run it I got:




Exception in thread "main"

org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/#: Expected mime type application/octet-stream but got text/html.




Note that this query worked when I tried it with a two cluster server (as shown in "http://lucene.apache.org/solr/guide/7_5/solr-tutorial.html"



can someone please explain the difference between



Solr.cmd -e cloud


and



solr.cmd -e techproducts


Why does only cloud have collections?



Also, I am struggling to override the SolrConfig.xml file using an API, can someone please explain the steps needed to create an API for overriding SolrConfig.xml. I tried using curl commands to do so from cmd, but I think that is a wrong approach. config API is accessible through http://localhost:8983/solr/techproducts/config
but how do I use it?



I apologize for the incoherence, this is the first time I am posting anything on Stack Overflow.



Thanks in advance!










share|improve this question

























  • Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

    – Aman Tandon
    Nov 23 '18 at 16:43











  • I was about to say that doesn't work, but it did. Thanks!

    – kutchinka
    Nov 24 '18 at 18:35











  • Can you please explain why is it without the # when querying but with it when accessing from the admin?

    – kutchinka
    Nov 24 '18 at 18:38











  • A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

    – MatsLindh
    Nov 24 '18 at 21:33











  • Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

    – kutchinka
    Nov 25 '18 at 15:09


















0















eWorking on a Natural language processing project using Solr.



I am a complete amateur in relation to Solr, So keep that in mind please. I started a solr server using cmd:



 Solr.cmd Start -e techproducts


then I tried querying using SolrJ



public class SolrJ {
public static void main(String args) throws SolrServerException, IOException {
SolrClient client = new Builder("http://localhost:8983/solr/#").build();
QueryResponse response = client.query(new SolrQuery("*:*"));
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
System.out.println(results.get(i));
}
}
}


When run it I got:




Exception in thread "main"

org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/#: Expected mime type application/octet-stream but got text/html.




Note that this query worked when I tried it with a two cluster server (as shown in "http://lucene.apache.org/solr/guide/7_5/solr-tutorial.html"



can someone please explain the difference between



Solr.cmd -e cloud


and



solr.cmd -e techproducts


Why does only cloud have collections?



Also, I am struggling to override the SolrConfig.xml file using an API, can someone please explain the steps needed to create an API for overriding SolrConfig.xml. I tried using curl commands to do so from cmd, but I think that is a wrong approach. config API is accessible through http://localhost:8983/solr/techproducts/config
but how do I use it?



I apologize for the incoherence, this is the first time I am posting anything on Stack Overflow.



Thanks in advance!










share|improve this question

























  • Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

    – Aman Tandon
    Nov 23 '18 at 16:43











  • I was about to say that doesn't work, but it did. Thanks!

    – kutchinka
    Nov 24 '18 at 18:35











  • Can you please explain why is it without the # when querying but with it when accessing from the admin?

    – kutchinka
    Nov 24 '18 at 18:38











  • A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

    – MatsLindh
    Nov 24 '18 at 21:33











  • Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

    – kutchinka
    Nov 25 '18 at 15:09














0












0








0








eWorking on a Natural language processing project using Solr.



I am a complete amateur in relation to Solr, So keep that in mind please. I started a solr server using cmd:



 Solr.cmd Start -e techproducts


then I tried querying using SolrJ



public class SolrJ {
public static void main(String args) throws SolrServerException, IOException {
SolrClient client = new Builder("http://localhost:8983/solr/#").build();
QueryResponse response = client.query(new SolrQuery("*:*"));
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
System.out.println(results.get(i));
}
}
}


When run it I got:




Exception in thread "main"

org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/#: Expected mime type application/octet-stream but got text/html.




Note that this query worked when I tried it with a two cluster server (as shown in "http://lucene.apache.org/solr/guide/7_5/solr-tutorial.html"



can someone please explain the difference between



Solr.cmd -e cloud


and



solr.cmd -e techproducts


Why does only cloud have collections?



Also, I am struggling to override the SolrConfig.xml file using an API, can someone please explain the steps needed to create an API for overriding SolrConfig.xml. I tried using curl commands to do so from cmd, but I think that is a wrong approach. config API is accessible through http://localhost:8983/solr/techproducts/config
but how do I use it?



I apologize for the incoherence, this is the first time I am posting anything on Stack Overflow.



Thanks in advance!










share|improve this question
















eWorking on a Natural language processing project using Solr.



I am a complete amateur in relation to Solr, So keep that in mind please. I started a solr server using cmd:



 Solr.cmd Start -e techproducts


then I tried querying using SolrJ



public class SolrJ {
public static void main(String args) throws SolrServerException, IOException {
SolrClient client = new Builder("http://localhost:8983/solr/#").build();
QueryResponse response = client.query(new SolrQuery("*:*"));
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
System.out.println(results.get(i));
}
}
}


When run it I got:




Exception in thread "main"

org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/#: Expected mime type application/octet-stream but got text/html.




Note that this query worked when I tried it with a two cluster server (as shown in "http://lucene.apache.org/solr/guide/7_5/solr-tutorial.html"



can someone please explain the difference between



Solr.cmd -e cloud


and



solr.cmd -e techproducts


Why does only cloud have collections?



Also, I am struggling to override the SolrConfig.xml file using an API, can someone please explain the steps needed to create an API for overriding SolrConfig.xml. I tried using curl commands to do so from cmd, but I think that is a wrong approach. config API is accessible through http://localhost:8983/solr/techproducts/config
but how do I use it?



I apologize for the incoherence, this is the first time I am posting anything on Stack Overflow.



Thanks in advance!







java curl solr solrj solrcloud






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 18:42







kutchinka

















asked Nov 23 '18 at 14:39









kutchinkakutchinka

104




104













  • Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

    – Aman Tandon
    Nov 23 '18 at 16:43











  • I was about to say that doesn't work, but it did. Thanks!

    – kutchinka
    Nov 24 '18 at 18:35











  • Can you please explain why is it without the # when querying but with it when accessing from the admin?

    – kutchinka
    Nov 24 '18 at 18:38











  • A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

    – MatsLindh
    Nov 24 '18 at 21:33











  • Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

    – kutchinka
    Nov 25 '18 at 15:09



















  • Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

    – Aman Tandon
    Nov 23 '18 at 16:43











  • I was about to say that doesn't work, but it did. Thanks!

    – kutchinka
    Nov 24 '18 at 18:35











  • Can you please explain why is it without the # when querying but with it when accessing from the admin?

    – kutchinka
    Nov 24 '18 at 18:38











  • A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

    – MatsLindh
    Nov 24 '18 at 21:33











  • Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

    – kutchinka
    Nov 25 '18 at 15:09

















Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

– Aman Tandon
Nov 23 '18 at 16:43





Try removing the char # from the Solr url and please try again with localhost:8983/solr/techproducts

– Aman Tandon
Nov 23 '18 at 16:43













I was about to say that doesn't work, but it did. Thanks!

– kutchinka
Nov 24 '18 at 18:35





I was about to say that doesn't work, but it did. Thanks!

– kutchinka
Nov 24 '18 at 18:35













Can you please explain why is it without the # when querying but with it when accessing from the admin?

– kutchinka
Nov 24 '18 at 18:38





Can you please explain why is it without the # when querying but with it when accessing from the admin?

– kutchinka
Nov 24 '18 at 18:38













A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

– MatsLindh
Nov 24 '18 at 21:33





A # is a local anchor - it's only used by the browser - it should never be transferred to the server. If your client actually escapes the # and sends it to the server, the server doesn't understand what's happening (i.e. the server have no resource named #, as this is never sent to the server by the browser). See Fragment identifier.

– MatsLindh
Nov 24 '18 at 21:33













Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

– kutchinka
Nov 25 '18 at 15:09





Thanks! As for the request handler that i want to develop to interact with SolrConfig, are you familiar with SolrJ commands? If so, could you please explain how do I send a request to override the SolrConfig from SolrJ? If not, I would love a short explanation on the Config API.Every command that is longer than 1 line in cmd didn't work and was considered by the cmd as seperate commands.

– kutchinka
Nov 25 '18 at 15:09












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448689%2fusing-solrj-querying-and-indexing%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448689%2fusing-solrj-querying-and-indexing%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Hercules Kyvelos

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud