Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

More StackOverFlow posts / recommendations #432

Open
phkrief opened this issue Nov 23, 2019 · 17 comments
Open

More StackOverFlow posts / recommendations #432

phkrief opened this issue Nov 23, 2019 · 17 comments
Assignees
Labels
enhancement User Interface Issues or enhancements related to the SCAVA User Interface
Milestone

Comments

@phkrief
Copy link

phkrief commented Nov 23, 2019

Hi,
Would it be possible to list more SOF posts?
For example, we could specify in the preference the max amount of results.

Thanks

@phkrief phkrief added enhancement User Interface Issues or enhancements related to the SCAVA User Interface labels Nov 23, 2019
@phkrief phkrief added this to the 1.15.275.rev0 milestone Nov 23, 2019
@creat89
Copy link
Contributor

creat89 commented Nov 23, 2019

Which recommender are you using?

@phkrief
Copy link
Author

phkrief commented Nov 23, 2019

Actually, I realize that I don't get the same posts depending on the code. You will say, "Of course!"
Unfortunately, for our example, it is a shame.

For example if I ask recommendations on this code:

package openweather.json_simple;

import java.io.IOException;

import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

public class App {

static String OpenWeathermapAPI = "http://api.openweathermap.org/data/2.5/weather?q={city}&appid=abbcea2020f75409af198b98de40e3a6";
public static void main(String[] args) throws IOException, ParseException {
	// Parsing of the API result
	JSONParser parser = new JSONParser();
}

}

I don't get the same posts if I add before the code about the URL access:

=============
package openweather.json_simple;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

public class App {

static String OpenWeathermapAPI = "http://api.openweathermap.org/data/2.5/weather?q={city}&appid=abbcea2020f75409af198b98de40e3a6";

public static void main(String[] args) throws IOException, ParseException {
	// Creation of the REST API
	String city = (args.length != 0)? args[0]:"Toulouse";
	String restAPI = OpenWeathermapAPI.replace("{city}", city);
	URL url = new URL(restAPI);
	// Access to the  REST API
	HttpURLConnection con = (HttpURLConnection) url.openConnection();
	con.setRequestMethod("GET");
	con.setConnectTimeout(5000);
	con.setReadTimeout(5000);
	int status = con.getResponseCode();
	if (status == HttpURLConnection.HTTP_OK) {
		BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
		try {
			// Parsing of the API result
			JSONParser parser = new JSONParser();
			JSONObject jsonObject = (JSONObject) parser.parse(in);
		} finally {
			in.close();
		}
	}
}

}

@creat89
Copy link
Contributor

creat89 commented Nov 23, 2019

Yes, I got it. But which recommender are you using? The KB has multiple recommenders and only four are created by us, all of them called CROSSIndex (there is one for Java, C, PHP and JavaScript). If you're using other recommenders, those are created by UDA and they are not connected to the Indexes that we generate. UDA decided to create their own indexes with specific dumps of data.

@phkrief
Copy link
Author

phkrief commented Nov 24, 2019

Oh?! In the present case, I'm calling the recommender used by the Eclipse Plugin when you select the item: "Request API documentation and Q&A posts".
Thx

@creat89
Copy link
Contributor

creat89 commented Nov 24, 2019

That's a UDA recommender, so I cannot help you. I'll put Juri as the assigned to the issue.

@creat89 creat89 assigned jdirocco and unassigned creat89 Nov 24, 2019
@davidediruscio
Copy link
Contributor

davidediruscio commented Nov 24, 2019 via email

@phkrief
Copy link
Author

phkrief commented Nov 24, 2019

@davidediruscio do you mean that StackOverFlow API provides only the 5 first posts of a request?
Thanks

@creat89
Copy link
Contributor

creat89 commented Nov 24, 2019

None of the recommenders is connected to StackOverflow API. All, including ours, make use of dumps. I'm sure Davide was referring to other stuff.

@phkrief
Copy link
Author

phkrief commented Nov 24, 2019

Hi @creat89 , do you mean that the StackOverFlow posts we get come from our KB? If not fro where do they come from if they don't come from a StackOverFlow API? I don't understand what you mean by "dumps"

@creat89
Copy link
Contributor

creat89 commented Nov 24, 2019

Yes, the SO posts come from files that have been processed and indexed by the KB. The KB doesn't connect itself to StackOverflow servers.

And I refer to dumps to the file that every three months more or less the owners of Stack Overflow publish (a huge XML file that contains all the information from SO https://archive.org/details/stackexchange).

@davidediruscio
Copy link
Contributor

davidediruscio commented Nov 24, 2019 via email

@phkrief
Copy link
Author

phkrief commented Nov 24, 2019

Thx a lot @davidediruscio. I should have done that first, you are right.
So I check out the chapter 7 and discovered the Figure 23: The SOrec architecture.
I didn't realize/understand that we were filtering, analysing and indexing StackOverFlow.
Thx a lot for pointing that.
It clarifies things

@phkrief
Copy link
Author

phkrief commented Nov 24, 2019

So, let's come back to my initial demand.
With this information, I don't understand your comment "Yes, that is how SORec works. The import statements also have a role in the selection of SO posts."
Are we limited by the number of results?
Thx

@davidediruscio
Copy link
Contributor

Hi @phkrief we intentionally limited the results to the most 5 relevant posts. Indeed, we could add more in the results. However, let's keep the possibility of specifying the size of the results as a nice to have feature for the moment. Does it make sense?

@jdirocco
Copy link
Member

The number of so results can be set in the configuration file.
please have a look at
https://github.com/crossminer/scava-deployment/blob/c4e9501f8758ebd47773fce552b487819eaa3d2c/KB/application.properties#L23

@davidediruscio
Copy link
Contributor

@md2manoppello sure I know, but to allow end-users to change that parameter from the Eclipse IDE some more work is needed, which is in my opinion of not high priority for now.

@phkrief
Copy link
Author

phkrief commented Nov 29, 2019

yes, @davidediruscio and @md2manoppello , it works for me.
And I already identified as an enhancement. For me an 'enhancement" means 'nice to have'.
Are you OK with that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement User Interface Issues or enhancements related to the SCAVA User Interface
Projects
None yet
Development

No branches or pull requests

5 participants